home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UUPC11QS.ARJ / DEFCHR.H < prev    next >
Text File  |  1989-09-26  |  8KB  |  157 lines

  1. /*                                     */
  2. /* DEFCHR - Definitions for the character devices (CON, AUX, and PRN)     */
  3. /*                                     */
  4.  
  5.  
  6. /*  Define functions of BIOS_CONFUNC, BIOS_PRNFUNC, and BIOS_AUXFUNC     */
  7.  
  8. #define CHR_WRITE    0x00        /* Write function                 */
  9. #define CHR_READ    CHR_WRITE+1 /* Read function                 */
  10. #define CHR_STATUS    CHR_READ+1  /* Status function                 */
  11. #define   CHR_SFGS     0x00          /* Get status subfunction          */
  12. #define     CHRS_WA     0x01        /* <ETX> sent, waiting for <ACK>     */
  13. #define     CHRS_WD     0x02        /* <DC3> seen, waiting for <DC1>     */
  14. #define     CHRS_SN     0x04        /* Sending nulls             */
  15. #define     CHRS_TXR       0x80     /* Transmitter ready to send data    */
  16. #define     CHRS_RXR      0x40        /* Receiver has data             */
  17. #define     CHRS_RXOF      0x20        /* Receiver queue overflow         */
  18. #define     CHRS_RXE      0x10        /* Other type of reciver error         */
  19. #define     CHRS_TXE     0x08        /* Transmitter error             */
  20. #define   CHR_SFGC      CHR_SFGS+1  /* Get configuration info subfunction  */
  21. #define CHR_CONTROL    CHR_STATUS+1 /* Control function             */
  22. #define   CHR_CFSU     0x00          /* Setup new configuration parms subfunction */
  23. #define   CHR_CFCI      CHR_CFSU+1  /* Clear input subfunction         */
  24. #define   CHR_CFCO      CHR_CFCI+1  /* Clear output subfunction         */
  25. #define CHR_LOOK    CHR_CONTROL+1 /* Nondestructive read function         */
  26. #define CHR_FMAX    CHR_LOOK    /* Maximum function number             */
  27.  
  28.  
  29. /* Configuration information packet                     */
  30.  
  31. #define CHRD_CLASS   0x00        /* Device class                 */
  32. #define   CHRDCL_CRT   0x00          /* Internal keyboard/display         */
  33. #define   CHRDCL_SER      CHRDCL_CRT+1 /* 2661 serial port             */
  34. #define   CHRDCL_PAR      CHRDCL_SER+1 /* PIA parallel port             */
  35. #define   CHRDCL_MAX      CHRDCL_PAR  /* Maximum class value             */
  36. #define CHRD_ATTR    CHRD_CLASS+1 /* Attributes                 */
  37. #define   CHRDA_SPI    0x01          /* Strip parity on input             */
  38. #define   CHRDA_SPO    0x02          /* Strip parity on output          */
  39. #define   CHRDA_MLI    0x04          /* Map lower to upper case on input    */
  40. #define   CHRDA_MLO    0x08          /* Map lower to upper case on output   */
  41.  
  42. /* The remaining fields are used only with the 2661 serial ports     */
  43. /*  (except CHRD_NCHR and CHRD_NCNT which can be used by para printer)     */
  44.  
  45. #define CHRD_PORT    CHRD_ATTR+1 /* Port number                 */
  46. #define CHRD_BAUD    CHRD_PORT+2 /* Baud rate                 */
  47. #define   BD455        0x00          /* 45.5                     */
  48. #define   BD050        0x01          /* 50                     */
  49. #define   BD075        0x02          /* 75                     */
  50. #define   BD110       3          /* 110                     */
  51. #define   BD134        0x04          /* 134.5                     */
  52. #define   BD150        0x05          /* 150                     */
  53. #define   BD300       6          /* 300                     */
  54. #define   BD600       7          /* 600                     */
  55. #define   BD120        0x08          /* 1200                     */
  56. #define   BD180       9          /* 1800                     */
  57. #define   BD200       10          /* 2000                     */
  58. #define   BD240       11          /* 2400                     */
  59. #define   BD480       12          /* 4800                     */
  60. #define   BD960       13          /* 9600                     */
  61. #define   BD192       14          /* 19200                     */
  62. #define   BD384       15          /* 38400                     */
  63. #define   BDMAX       BD384       /* Maximum valid baud rate         */
  64. #define CHRD_HSHK    CHRD_BAUD+1 /* Handshaking protocol             */
  65. #define   CHRDH_NO     0x00          /* None                     */
  66. #define   CHRDH_EAH      CHRDH_NO+1  /* <ETX>/<ACK>                 */
  67. #define   CHRDH_DCH      CHRDH_EAH+1 /* <DC3>/<DC1> (CTRL-S/CTRL-Q)         */
  68. #define   CHRDH_DCDH      CHRDH_DCH+1 /* DCD(data carrier detect) high         */
  69. #define   CHRDH_DCDL      CHRDH_DCDH+1 /* DCD low                 */
  70. #define   CHRDH_DSRH      CHRDH_DCDL+1 /* DSR(data set ready) high         */
  71. #define   CHRDH_DSRL      CHRDH_DSRH+1 /* DSR low                 */
  72. #define   CHRDH_MAX      CHRDH_DSRL  /* Maximum valid value             */
  73. #define CHRD_BCTL    CHRD_HSHK+1 /* Stop bits/parity/char length         */
  74.                 /*   (2661 Mode register 1)         */
  75. #define   CHRDB_SB      0xC0          /* Stop bits                 */
  76. #define     CHRDB_SB1      0x40        /* 1 stop bit                 */
  77. #define     CHRDB_SB15       0x80     /* 1.5 stop bits             */
  78. #define     CHRDB_SB2        0xC0    /* 2 stop bits                 */
  79. #define   CHRDB_PT    0x20          /* Parity type(0=odd, 1=even)         */
  80. #define   CHRDB_PC    0x10          /* Parity contr(0=disabled, 1=enabled) */
  81. #define   CHRDB_CL     0x0C          /* Character length             */
  82. #define     CHRDB_CL5     0x00        /* 5 bits                 */
  83. #define     CHRDB_CL6     0x04        /* 6 bits                 */
  84. #define     CHRDB_CL7     0x08        /* 7 bits                 */
  85. #define     CHRDB_CL8       0x0C     /* 8 bits                 */
  86. #define CHRD_ECNT    CHRD_BCTL+1 /* If <ETX>/<ACK> used, chars to         */
  87.                 /*   send before <ETX> sent         */
  88. #define CHRD_NCNT    CHRD_ECNT+1 /* Number of NULLs to send after         */
  89.                 /*   CHRD_NCHR seen             */
  90. #define CHRD_NCHR    CHRD_NCNT+1 /* Character after which to send NULLs   */
  91. #define CHRD_RES    CHRD_NCHR+1 /* Reserved for future use             */
  92. #define CHRD_SIZE    CHRD_RES+6  /* Size of a CHRD                 */
  93.  
  94.  
  95. /* Error codes that are returned                     */
  96.  
  97. #define CHRE_ILGFH   0x00        /* Illegal function code in AH         */
  98. #define CHRE_ILGFL    CHRE_ILGFH+1 /* Illegal function code in AL         */
  99. #define CHRE_NWR    CHRE_ILGFL+1 /* No writes allowed to device         */
  100. #define CHRE_NRD    CHRE_NWR+1  /* No reads allowed to device         */
  101. #define CHRE_BSUP    CHRE_NRD+1  /* Bad set up parameters             */
  102. #define CHRE_WRB    CHRE_BSUP+1 /* Device busy on write             */
  103. #define CHRE_RDNR    CHRE_WRB+1  /* Device not ready on read          */
  104. #define CHRE_HTO    CHRE_RDNR+1 /* Software handshake time out         */
  105. #define CHRE_ILR    CHRE_HTO+1  /* Illegal responce from device         */
  106. #define CHRE_IQE    CHRE_ILR+1  /* Input queue empty             */
  107. #define CHRE_NIQ    CHRE_IQE+1  /* Device has no input queue         */
  108.  
  109.  
  110. /* Internal character device control table(It includes an embedded CHRD) */
  111.  
  112. #define CID_CHRD     0x00        /* A CHRD                     */
  113. #define CID_CLASS    CID_CHRD+CHRD_SIZE  /* Class of character device     */
  114.                     /*   (must be mult of 2)     */
  115. #define   CIDCL_CRT      CHRDCL_CRT*2 /* Internal video/keyboard         */
  116. #define   CIDCL_SER      CHRDCL_SER*2 /* 2661 serial port             */
  117. #define   CIDCL_PAR      CHRDCL_PAR*2 /* PIA parallel port             */
  118. #define CID_TYPE    CID_CLASS+2 /* Special types                 */
  119. #define   CIDTY_NORM   0x00           /* Normal type                 */
  120. #define   CIDTY_CSP      CIDTY_NORM+1 /* Special CRT                 */
  121. #define CID_IPORT    CID_TYPE+2  /* Input port                 */
  122. #define CID_OPORT    CID_IPORT+2 /* Output port                 */
  123. #define CID_SPORT    CID_OPORT+2 /* Status port                 */
  124. #define CID_CPORT    CID_SPORT+2 /* Control port                 */
  125. #define CID_ST        CID_CPORT+2 /* Status(see CHRD_SFGS for values)      */
  126. #define CID_IRM     CID_ST+1    /* Input ready mask              */
  127. #define CID_IPM     CID_IRM+1   /* Input polarity mask             */
  128. #define CID_ORM     CID_IPM+1   /* Output ready mask             */
  129. #define CID_OPM     CID_ORM+1   /* Output polarity mask             */
  130. #define CID_ECTR    CID_OPM+1   /* Char counter for sending <ETX>         */
  131. #define CID_NCTR    CID_ECTR+1  /* Null down counter             */
  132. #define CID_SIZE    CID_NCTR+1  /* Size of the a CID             */
  133.  
  134.  
  135. /*                                     */
  136. /* Define queue for character devices                     */
  137. /*                                     */
  138.  
  139. #define CQ_SADDR     0x00        /* Addr of start of queue             */
  140. #define CQ_EADDR    CQ_SADDR+2  /* Addr of end of queue             */
  141. #define CQ_QSIZE    CQ_EADDR+2  /* Size of queue                 */
  142. #define CQ_ELMTS    CQ_QSIZE+2  /* Number of elements currently in queue */
  143. #define CQ_STATUS    CQ_ELMTS+2  /* Status (as defined under CHR_STATUS)  */
  144. #define CQ_FRONT    CQ_STATUS+1 /* Addr of first element in queue         */
  145. #define CQ_REAR     CQ_FRONT+2  /* Addr of last element in queue         */
  146. #define CQ_SEGM     CQ_REAR+2   /* Segment of que                 */
  147. #define CQ_SIZE     CQ_SEGM+2   /* Size of a CQ                 */
  148.  
  149. /*     queue sizes                             */
  150.  
  151. #define ZSERA_IQS        255     /* Serial A input que             */
  152. #define ZSERA_OQS        255     /* Serial A output que             */
  153. #define ZSERB_IQS        255     /* Serial B input que             */
  154. #define ZSERB_OQS        255     /* Serial B output que             */
  155. #define ZCON_IQS        90        /* Input que size                 */
  156. #define ZCON_IQS1        ZCON_IQS-10     /* Actual que size             */
  157.